<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增gzmx_scdw')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-gzmx_scdw-add">
        <input name="jb" id="jb" class="form-control" type="hidden">
        <input id="treeId" name="fdwdm" type="hidden" th:value="${gzmx_scdw?.id}"/>
            <div class="form-group">    
                <label class="col-sm-3 control-label">点位名称：</label>
                <div class="col-sm-8">
                    <input name="dwmc" class="form-control" type="text">
                </div>
            </div>           
            <div class="form-group" id="div_fdwdm">    
                <label class="col-sm-3 control-label">父点位代码：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        
                        <input class="form-control" type="text" onclick="selectDeptTree()" id="treeName" readonly="true" th:value="${gzmx_scdw?.dwmc}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <!--  
             <div class="form-group">    
                <label class="col-sm-3 control-label">级别：</label>
                <div class="col-sm-8">
                    <input name="jb" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">单位ID：</label>
                <div class="col-sm-8">
                    <input name="deptId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">用户ID：</label>
                <div class="col-sm-8">
                    <input name="userId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">二级单位ID：</label>
                <div class="col-sm-8">
                    <input name="ejdwId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">二级单位名称：</label>
                <div class="col-sm-8">
                    <input name="ejdwName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">作业区ID：</label>
                <div class="col-sm-8">
                    <input name="zyqId" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">作业区名称：</label>
                <div class="col-sm-8">
                    <input name="zyqName" class="form-control" type="text">
                </div>
            </div>
            -->
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "gzmx_scdw/gzmx_scdw"
        $("#form-gzmx_scdw-add").validate({
            focusCleanup: true
        });
        $(function(){
   	     
   	     var dd=[[*{gzmx_scdw.jb}]];
   	    
   	   	 switch(Number(dd)) {
   		 case 0:
    	    	// $("#div_khxm").attr("style","display:none;");//考核项目
    	    	 $("#div_khmc").attr("style","display:none;");//考核名称
    	    	 $("#jb").val(dd+1);//考核级别
    	    	 $("#div_jb").attr("style","display:none;");//考核级别
    	    	 $("#div_treeId").attr("style","display:none;");//父考核代码
    	    	 $("#div_khfx").attr("style","display:none;");//考核分项
    	    	 $("#div_khfz").attr("style","display:none;");//考核分值
    	    	 $("#div_kenr").attr("style","display:none;");//考核内容    	 
    	    	break;
   	   
   	     case 1:
   	    	
   	    	     $("#div_khxm").attr("style","display:none;");//考核项目
    	    	 $("#div_khmc").attr("style","display:none;");//考核名称
    	    	 $("#jb").val(dd+1);//考核级别
    	    	 $("#div_jb").attr("style","display:none;");//考核级别
                 
        		
        		 $("#cbs_khlx").attr("disabled",true);
    	    	 $("#div_treeId").attr("style","display:none;");//父考核代码
    	    	
    	    	// $("#div_khfx").attr("style","display:none;");//考核分项
    	    	// $("#div_khfz").attr("style","display:none;");//考核分值
    	    	// $("#div_kenr").attr("style","display:none;");//考核内容  
   	        break;
   	     case 2:
   	    	    $("#div_fdwdm").attr("style","display:none;");//父考核代码
   	    	      
     	    	 $("#jb").val(dd+1);//考核级别
     	    	 $("#div_jb").attr("style","display:none;");//考核级别     	    	 
    	     	 $("#div_treeId").attr("style","display:none;");//父考核代码
     	    	 
     	    	 //$("#div_kenr").attr("style","display:none;");//考核内容  
    	     break;
   	  case 3:
	    	 $("#div_fdwdm").attr("style","display:none;");//父考核代码
	    	      
	    	 $("#jb").val(dd+1);//考核级别
	    	 $("#div_jb").attr("style","display:none;");//考核级别     	    	 
	     	 $("#div_treeId").attr("style","display:none;");//父考核代码
	    	  
	    	 //$("#div_kenr").attr("style","display:none;");//考核内容  
	     break;
   	 case 4:
   	         $("#div_fdwdm").attr("style","display:none;");//父考核代码   	      
   	         $("#jb").val(dd+1);//考核级别
   	         $("#div_jb").attr("style","display:none;");//考核级别     	    	 
    	     $("#div_treeId").attr("style","display:none;");//父考核代码
   	  
   	       //$("#div_kenr").attr("style","display:none;");//考核内容  
    break;
   	 	
   	} 
   		
  
      
   });
        
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-gzmx_scdw-add').serialize());
            }
        }

        /*gzmx_scdw-新增-选择父gzmx_scdw树*/
        function selectGzmx_scdwTree() {
            var options = {
                title: 'gzmx_scdw选择',
                width: "380",
                url: prefix + "/selectGzmx_scdwTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = $.modal.getChildFrame(index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            $.modal.close(index);
        }
        
        /* 用户管理-新增-选择部门树 */
        function selectDeptTree() {
        	var treeId = $("#treeId").val();
        	var deptId = $.common.isEmpty(treeId) ? "100" : $("#treeId").val();
        	var url = ctx + "system/dept/selectDeptTree/" + deptId;
			var options = {
				title: '选择部门',
				width: "380",
				url: url,
				callBack: doSubmit1
			};
			$.modal.openOptions(options);
		}
        function doSubmit1(index, layero){
			var tree = layero.find("iframe")[0].contentWindow.$._tree;
			var body = $.modal.getChildFrame(index);
   			$("#treeId").val(body.find('#treeId').val());
   			$("#treeName").val(body.find('#treeName').val());
   			$.modal.close(index);
		}

    </script>
</body>
</html>